import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import MyHomeView from '../views/MyHomeView.vue'
import SQLView from '../views/SQLView.vue'
import GitView from '../views/GitView.vue'
import JavaView from '../views/JavaView.vue'
import NavBar from '../components/NavBar.vue' //
Vue.use(VueRouter)

const routes = [
  {
    path: '/shan',
    component: NavBar,
  },
  {
    path: '/',
    component: HomeView,
  },
  {
    path: '/HomeView',
    name: 'HomeView',
    // 重定向到首页
    redirect: '/',
  },
  {
    path: '/MyHomeView',
    name: 'MyHomeView',
    component: MyHomeView
  },
  {
    path: '/GitView',
    name: 'GitView',
    component: GitView,
    children: [
      {
        path: 'giao',
        component: NavBar
      }
    ]
  },
  {
    path: '/JavaView',
    name: 'JavaView',
    component: JavaView
  },
  {
    path: '/SQLView',
    name: 'SQLView',
    component: SQLView
  },
  {
    path: '/AboutView',
    name: 'AboutView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  // 添加mode: 'history',取消地址栏中的#号
  // mode: 'history',
  routes
})

export default router
